package com.aifast.system.log.dao;

import com.aifast.common.base.Kv;
import com.aifast.common.forUpdate.ForUpdate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface ForUpdateDao extends BaseMapper<ForUpdate> {

    @Select("select table_name as `name` , table_comment as `comment`, create_time, update_time from information_schema.tables\n" +
            "where table_schema = (select database())\n" +
            "order by create_time desc")
    List<Kv<String,String>> getAllTableNames();

    @Select("select column_name as `name`, column_comment as `comment` from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName}) order by ordinal_position")
    List<Kv<String,String>> getTableColumnComment(String tableName);

}
